.\"***************************************************************************
.\" Copyright 2018-2023,2024 Thomas E. Dickey                                *
.\" Copyright 2010-2015,2017 Free Software Foundation, Inc.                  *
.\"                                                                          *
.\" Permission is hereby granted, free of charge, to any person obtaining a  *
.\" copy of this software and associated documentation files (the            *
.\" "Software"), to deal in the Software without restriction, including      *
.\" without limitation the rights to use, copy, modify, merge, publish,      *
.\" distribute, distribute with modifications, sublicense, and/or sell       *
.\" copies of the Software, and to permit persons to whom the Software is    *
.\" furnished to do so, subject to the following conditions:                 *
.\"                                                                          *
.\" The above copyright notice and this permission notice shall be included  *
.\" in all copies or substantial portions of the Software.                   *
.\"                                                                          *
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
.\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
.\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
.\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
.\" THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
.\"                                                                          *
.\" Except as contained in this notice, the name(s) of the above copyright   *
.\" holders shall not be used in advertising or otherwise to promote the     *
.\" sale, use or other dealings in this Software without prior written       *
.\" authorization.                                                           *
.\"***************************************************************************
.\"
.\" $Id: curs_sp_funcs.3x,v 1.50 2024/04/20 18:56:31 tom Exp $
.TH sp_funcs 3NCURSES 2024-04-20 "ncurses 6.5" "Library calls"
.ie \n(.g \{\
.ds `` \(lq
.ds '' \(rq
.\}
.el \{\
.ie t .ds `` ``
.el   .ds `` ""
.ie t .ds '' ''
.el   .ds '' ""
.\}
.SH NAME
\fB\%curs_sp_funcs\fP \-
\fIcurses\fR screen-pointer extension
.SH SYNOPSIS
.nf
\fB#include <curses.h>
.PP
\fBint alloc_pair_sp(SCREEN* \fIsp\fP, int \fIfg\fP, int \fIbg\fP);
\fBint assume_default_colors_sp(SCREEN* \fIsp\fP, int \fIfg\fP, int \fIbg\fP);
\fBint baudrate_sp(SCREEN* \fIsp\fP);
\fBint beep_sp(SCREEN* \fIsp\fP);
\fBbool can_change_color_sp(SCREEN* \fIsp\fP);
\fBint cbreak_sp(SCREEN* \fIsp\fP);
\fBint color_content_sp(SCREEN* \fIsp\fP, short \fIcolor\fP, short* \fIr\fP, short* \fIg\fP, short* \fIb\fP);
\fBint curs_set_sp(SCREEN* \fIsp\fP, int \fIvisibility\fP);
\fBint def_prog_mode_sp(SCREEN* \fIsp\fP);
\fBint def_shell_mode_sp(SCREEN* \fIsp\fP);
.PP
\fBint define_key_sp(SCREEN* \fIsp\fP, const char * \fIdefinition\fP, int \fIkeycode\fP);
\fBint delay_output_sp(SCREEN* \fIsp\fP, int \fIms\fP);
\fBint doupdate_sp(SCREEN* \fIsp\fP);
\fBint echo_sp(SCREEN* \fIsp\fP);
\fBint endwin_sp(SCREEN* \fIsp\fP);
\fBchar erasechar_sp(SCREEN* \fIsp\fP);
\fBint erasewchar_sp(SCREEN* \fIsp\fP, wchar_t *\fIwc\fP);
\fBint extended_color_content_sp(SCREEN * \fIsp\fP, int \fIcolor\fP, int * \fIr\fP, int * \fIg\fP, int * \fIb\fP);
\fBint extended_pair_content_sp(SCREEN* \fIsp\fP, int \fIpair\fP, int * \fIfg\fP, int * \fIbg\fP);
\fBint extended_slk_color_sp(SCREEN* \fIsp\fP, int \fIpair\fP);
.PP
\fBvoid filter_sp(SCREEN* \fIsp\fP);
\fBint find_pair_sp(SCREEN* \fIsp\fP, int \fIfg\fP, int \fIbg\fP);
\fBint flash_sp(SCREEN* \fIsp\fP);
\fBint flushinp_sp(SCREEN* \fIsp\fP);
\fBint free_pair_sp(SCREEN* \fIsp\fP, int \fIpair\fP);
\fBint get_escdelay_sp(SCREEN* \fIsp\fP);
\fBint getmouse_sp(SCREEN* \fIsp\fP, MEVENT* \fIevent\fP);
\fBWINDOW* getwin_sp(SCREEN* \fIsp\fP, FILE* \fIfilep\fP);
\fBint halfdelay_sp(SCREEN* \fIsp\fP, int \fItenths\fP);
\fBbool has_colors_sp(SCREEN* \fIsp\fP);
.PP
\fBbool has_ic_sp(SCREEN* \fIsp\fP);
\fBbool has_il_sp(SCREEN* \fIsp\fP);
\fBint has_key_sp(SCREEN* \fIsp\fP, int \fIc\fP);
\fBbool has_mouse_sp(SCREEN* \fIsp\fP);
\fBint init_color_sp(SCREEN* \fIsp\fP, short \fIcolor\fP, short \fIr\fP, short \fIg\fP, short \fIb\fP);
\fBint init_extended_color_sp(SCREEN* \fIsp\fP, int \fIcolor\fP, int \fIr\fP, int \fIg\fP, int \fIb\fP);
\fBint init_extended_pair_sp(SCREEN* \fIsp\fP, int \fIpair\fP, int \fIfg\fP, int \fIbg\fP);
\fBint init_pair_sp(SCREEN* \fIsp\fP, short \fIpair\fP, short \fIfg\fP, short \fIbg\fP);
\fBint intrflush_sp(SCREEN* \fIsp\fP, WINDOW* \fIwin\fP, bool \fIbf\fP);
\fBint is_cbreak_sp(SCREEN* \fIsp\fP);
.PP
\fBint is_echo_sp(SCREEN* \fIsp\fP);
\fBint is_nl_sp(SCREEN* \fIsp\fP);
\fBint is_raw_sp(SCREEN* \fIsp\fP);
\fBbool is_term_resized_sp(SCREEN* \fIsp\fP, int \fIlines\fP, int \fIcolumns\fP);
\fBbool isendwin_sp(SCREEN* \fIsp\fP);
\fBint key_defined_sp(SCREEN* \fIsp\fP, const char *\fIdefinition\fP);
\fBchar* keybound_sp(SCREEN* \fIsp\fP, int \fIkeycode\fP, int \fIcount\fP);
\fBNCURSES_CONST char* keyname_sp(SCREEN* \fIsp\fP, int \fIc\fP);
\fBint keyok_sp(SCREEN* \fIsp\fP, int \fIkeycode\fP, bool \fIenable\fP);
\fBchar killchar_sp(SCREEN* \fIsp\fP);
.PP
\fBint killwchar_sp(SCREEN* \fIsp\fP, wchar_t *\fIwc\fP);
\fBchar* longname_sp(SCREEN* \fIsp\fP);
\fBint mcprint_sp(SCREEN* \fIsp\fP, char *\fIdata\fP, int \fIlen\fP);
\fBint mouseinterval_sp(SCREEN* \fIsp\fP, int \fIerval\fP);
\fBmmask_t mousemask_sp(SCREEN* \fIsp\fP, mmask_t \fInewmask\fP, mmask_t *\fIoldmask\fP);
\fBint mvcur_sp(SCREEN* \fIsp\fP, int \fIoldrow\fP, int \fIoldcol\fP, int \fInewrow\fP, int \fInewcol\fP);
\fBint napms_sp(SCREEN* \fIsp\fP, int \fIms\fP);
\fBWINDOW* newpad_sp(SCREEN* \fIsp\fP, int \fInrows\fP, int \fIncols\fP);
\fBSCREEN* new_prescr(void);
\fBSCREEN* newterm_sp(SCREEN* \fIsp\fP, const char *\fItype\fP, FILE *\fIoutfd\fP, FILE *\fIinfd\fP);
.PP
\fBWINDOW* newwin_sp(SCREEN* \fIsp\fP, int \fInlines\fP, int \fIncols\fP, int \fIbegin_y\fP, int \fIbegin_x\fP);
\fBint nl_sp(SCREEN* \fIsp\fP);
\fBint nocbreak_sp(SCREEN* \fIsp\fP);
\fBint noecho_sp(SCREEN* \fIsp\fP);
\fBvoid nofilter_sp(SCREEN* \fIsp\fP);
\fBint nonl_sp(SCREEN* \fIsp\fP);
\fBvoid noqiflush_sp(SCREEN* \fIsp\fP);
\fBint noraw_sp(SCREEN* \fIsp\fP);
\fBint pair_content_sp(SCREEN* \fIsp\fP, short \fIpair\fP, short* \fIfg\fP, short* \fIbg\fP);
\fBvoid qiflush_sp(SCREEN* \fIsp\fP);
.PP
\fBint raw_sp(SCREEN* \fIsp\fP);
\fBvoid reset_color_pairs_sp(SCREEN* \fIsp\fP);
\fBint reset_prog_mode_sp(SCREEN* \fIsp\fP);
\fBint reset_shell_mode_sp(SCREEN* \fIsp\fP);
\fBint resetty_sp(SCREEN* \fIsp\fP);
\fBint resize_term_sp(SCREEN* \fIsp\fP, int \fIlines\fP, int \fIcolumns\fP);
\fBint resizeterm_sp(SCREEN* \fIsp\fP, int \fIlines\fP, int \fIcolumns\fP);
\fBint ripoffline_sp(SCREEN* \fIsp\fP, int \fIline\fP, int (*\fIinit\fP)(WINDOW* \fIwin\fP, int \fIfmt\fP));
\fBint savetty_sp(SCREEN* \fIsp\fP);
\fBint scr_init_sp(SCREEN* \fIsp\fP, const char *\fIfilename\fP);
.PP
\fBint scr_restore_sp(SCREEN* \fIsp\fP, const char *\fIfilename\fP);
\fBint scr_set_sp(SCREEN* \fIsp\fP, const char *\fIfilename\fP);
\fBint set_escdelay_sp(SCREEN* \fIsp\fP, int \fIms\fP);
\fBint set_tabsize_sp(SCREEN* \fIsp\fP, int \fIcols\fP);
\fBint slk_attrset_sp(SCREEN* \fIsp\fP, const chtype \fIa\fP);
\fBint slk_attr_set_sp(SCREEN* \fIsp\fP, const attr_t \fIattrs\fP, short \fIpair\fP, void*\fIopts\fP);
\fBint slk_attroff_sp(SCREEN* \fIsp\fP, const chtype \fIa\fP);
\fBint slk_attron_sp(SCREEN* \fIsp\fP, const chtype \fIa\fP);
\fBattr_t slk_attr_sp(SCREEN* \fIsp\fP);
\fBint slk_clear_sp(SCREEN* \fIsp\fP);
.PP
\fBint slk_color_sp(SCREEN* \fIsp\fP, short \fIpair\fP);
\fBint slk_init_sp(SCREEN* \fIsp\fP, int \fIfmt\fP);
\fBchar* slk_label_sp(SCREEN* \fIsp\fP, int \fIlabnum\fP);
\fBint slk_noutrefresh_sp(SCREEN* \fIsp\fP);
\fBint slk_refresh_sp(SCREEN* \fIsp\fP);
\fBint slk_restore_sp(SCREEN* \fIsp\fP);
\fBint slk_set_sp(SCREEN* \fIsp\fP, int \fIlabnum\fP, const char * \fIlabel\fP, int \fIfmt\fP);
\fBint slk_touch_sp(SCREEN* \fIsp\fP);
\fBint start_color_sp(SCREEN* \fIsp\fP);
\fBattr_t term_attrs_sp(SCREEN* \fIsp\fP);
.PP
\fBchtype termattrs_sp(SCREEN* \fIsp\fP);
\fBchar* termname_sp(SCREEN* \fIsp\fP);
\fBint typeahead_sp(SCREEN* \fIsp\fP, int \fIfd\fP);
\fBint unget_wch_sp(SCREEN* \fIsp\fP, const wchar_t \fIwc\fP);
\fBint ungetch_sp(SCREEN* \fIsp\fP, int \fIc\fP);
\fBint ungetmouse_sp(SCREEN* \fIsp\fP, MEVENT* \fIevent\fP);
\fBint use_default_colors_sp(SCREEN* \fIsp\fP);
\fBvoid use_env_sp(SCREEN* \fIsp\fP, bool \fIbf\fP);
\fBint use_legacy_coding_sp(SCREEN* \fIsp\fP, int \fIlevel\fP);
\fBvoid use_tioctl_sp(SCREEN *\fIsp\fP, bool \fIbf\fP);
.PP
\fBint vid_attr_sp(SCREEN* \fIsp\fP, attr_t \fIattrs\fP, short \fIpair\fP, void * \fIopts\fP);
\fBint vid_puts_sp(SCREEN* \fIsp\fP, attr_t \fIattrs\fP, short \fIpair\fP, void * \fIopts\fP, NCURSES_SP_OUTC \fIputc\fP);
\fBint vidattr_sp(SCREEN* \fIsp\fP, chtype \fIattrs\fP);
\fBint vidputs_sp(SCREEN* \fIsp\fP, chtype \fIattrs\fP, NCURSES_SP_OUTC \fIputc\fP);
\fBwchar_t* wunctrl_sp(SCREEN* \fIsp\fP, cchar_t *\fIwch\fP);
.PP
\fB#include <form.h>
.PP
\fBFORM* new_form_sp(SCREEN* \fIsp\fP, FIELD **\fIfields\fP);
.PP
\fB#include <menu.h>
.PP
\fBMENU* new_menu_sp(SCREEN* \fIsp\fP, ITEM **\fIitems\fP);
.PP
\fB#include <panel.h>
.PP
\fBPANEL* ceiling_panel(SCREEN* \fIsp\fP);
\fBPANEL* ground_panel(SCREEN* \fIsp\fP);
\fBvoid update_panels_sp(SCREEN* \fIsp\fP);
.PP
\fB#include <term.h>
.PP
\fBint del_curterm_sp(SCREEN* \fIsp\fP, TERMINAL *\fIoterm\fP);
\fBint putp_sp(SCREEN* \fIsp\fP, const char *\fIstr\fP);
\fBint restartterm_sp(SCREEN* \fIsp\fP, NCURSES_CONST char*\fIterm\fP, int \fIfiledes\fP, int *\fIerrret\fP);
\fBTERMINAL* set_curterm_sp(SCREEN* \fIsp\fP, TERMINAL*\fInterm\fP);
\fBint tgetent_sp(SCREEN* \fIsp\fP, char *\fIbp\fP, const char *\fIname\fP);
\fBint tgetflag_sp(SCREEN* \fIsp\fP, const char *\fIcapname\fP);
\fBint tgetnum_sp(SCREEN* \fIsp\fP, const char *\fIcapname\fP);
\fBchar* tgetstr_sp(SCREEN* \fIsp\fP, const char *\fIcapname\fP, char **\fIarea\fP);
\fBchar* tgoto_sp(SCREEN* \fIsp\fP, const char *\fIcapname\fP, int \fIcol\fP, int \fIrow\fP);
\fBint tigetflag_sp(SCREEN* \fIsp\fP, const char *\fIcapname\fP);
.PP
\fBint tigetnum_sp(SCREEN* \fIsp\fP, const char *\fIcapname\fP);
\fBchar* tigetstr_sp(SCREEN* \fIsp\fP, const char *\fIcapname\fP);
\fI/* tparm_sp may use 9 long parameters rather than being variadic */
\fBchar* tparm_sp(SCREEN* \fIsp\fP, const char *\fIstr\fP, ...);
\fBint tputs_sp(SCREEN* \fIsp\fP, const char *\fIstr\fP, int \fIaffcnt\fP, NCURSES_SP_OUTC \fIputc\fP);
.PP
\fB#include <unctrl.h>
.PP
\fBNCURSES_CONST char* unctrl_sp(SCREEN* \fIsp\fP, chtype \fIch\fP);
.fi
.SH DESCRIPTION
This implementation can be configured to provide a set of functions which
improve the ability to manage multiple screens.
This feature can be added to any of the configurations supported by
\fI\%ncurses\fP;
it adds new symbols
without changing the meaning of any of the existing ones.
.\" ***************************************************************************
.SS "Improved Functions"
Most of the functions are new versions of existing functions.
A parameter is added at the front of the parameter list.
It is a \fISCREEN\fP pointer.
.PP
The existing functions all use the current screen,
which is a static variable.
The extended functions use the specified screen,
thereby reducing the number of variables which must be modified
to update multiple screens.
.\" ***************************************************************************
.SS "New Functions"
Here are the new functions:
.TP 5
ceiling_panel
this returns a pointer to the topmost panel in the given screen.
.TP 5
ground_panel
this returns a pointer to the lowest panel in the given screen.
.TP 5
new_prescr
when creating a new screen, the library uses static variables which
have been preset, e.g., by \fB\%use_env\fP(3NCURSES), \fB\%filter\fP(3NCURSES), etc.
With the screen-pointer extension,
there are situations where it must create a current screen before
the unextended library does.
The \fBnew_prescr\fP function is used internally to handle these cases.
It is also provided to allow applications to customize library
initialization.
.\" ***************************************************************************
.SH NOTES
This extension introduces some new names:
.TP 5
NCURSES_SP_FUNCS
This is set to the library patch-level number.
In the unextended library, this is zero (0),
to make it useful for checking if the extension is provided.
.TP 5
NCURSES_SP_NAME
The new functions are named using the macro \fINCURSES_SP_NAME\fP,
which hides the actual implementation.
Currently this adds a \*(``_sp\*('' suffix
to the name of the unextended function.
This manual page indexes the extensions showing the full name.
However the proper usage of these functions uses the macro,
to provide for the possibility of changing the naming convention
for specific library configurations.
.TP 5
NCURSES_SP_OUTC
This is a new function-pointer type to use in the screen-pointer functions
where an \fINCURSES_OUTC\fP is used in the unextended library.
.TP 5
NCURSES_OUTC
This is a function-pointer type used for the cases where a function passes
characters to the output stream, e.g., \fB\%vidputs\fP(3NCURSES).
.SH PORTABILITY
These routines are specific to \fI\%ncurses\fP.
They were not supported on Version 7, BSD or System V implementations.
It is recommended that any code depending on \fI\%ncurses\fP extensions
be conditioned using \fINCURSES_SP_FUNCS\fP.
.SH SEE ALSO
\fB\%ncurses\fP(3NCURSES),
\fB\%opaque\fP(3NCURSES),
\fB\%threads\fP(3NCURSES)
